{% extends 'base.html' %}
{% block title %}Lab 5 - Fail Open{% endblock %}
{% block body %}
    <div style="margin: 2px auto; width: 50%;">
        <form method="post" onsubmit="/Lab5/failopen">
            {% csrf_token %}
            Username: <input type="text" name="user" /><br/>
            Password: <input type="password" name="pass" /><br/>
            <input type="submit" name="Login" />
        </form><br/>
        <a href="/Lab5/policy">Review Policy</a><br/><br/>
        <pre>
            try:
                username = request.POST['user']
                password = request.POST['pass']

                user_obj = Users.objects.get(user=username, pass=password)

                if user_obj != None
                    content['message'] = "Login failed..."
                    return render_to_response("Lab5/failopen.html", content)
            except:
                print >>sys.stderr "Oh crap something happened. Oh noes!!!"

            content['message'] = "Login Successful..."
        </pre>
        {{ message }}
    </div>
{% endblock %}
